﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<cludg.Web.ViewModels.CommentDetailsModel>" %>
<%@ Import Namespace="cludg.Web.Core.RenderHelpers" %>
<%@ Import Namespace="cludg.Web.RenderHelpers" %>
<div class="comment">
	<a id="<%: string.Format("comment_{0}", Model.Value.Id) %>"></a>
	<div class="content">
		<%: Html.RenderImage(Model.Value.Author.SmallAvatar, "avatar")%>
		<div class="header">
			<%: Html.ProfileLink(Model.Value.Author) %>
			<%: Html.RenderDateTime(Model.Value.CreationTime)%>
		</div>
		<div class="text">
			<%= Model.Value.Text%>
		</div>
	</div>
	<% if (Model.CanReplay)
	{%>
	<%:Html.ActionLink("ответить", "Comment", new { id = Model.Value.Story.Id, commentId = Model.Value.Id }, new { @class = "reply" })%>
	<%--		<a href="#<%: string.Format("comment_{0}", Model.Value.Id) %>" onclick="SetCommentForm('<%: Model.Value.Id %>');" >replay...</a>
	--%>
	<%
		}%>

	<%if (Model.CanManage)
   {%>
	<div class="comment-admin-actions">
		<%
			if (!Model.Value.IsDeleted)
			{%>
		<%:Html.ActionLink("Удалить", "DeleteComment", "Story", new {id = Model.Value.Id}, null)%>
		<%
			}%>
		<%
			if (Model.Value.IsDeleted)
			{%>
		<%:Html.ActionLink("Восстановить", "RestoreComment", "Story", new {id = Model.Value.Id}, null)%>
		<%
			}%>
	</div>
	<%
		}%>

	<br style="clear: left;" />
	<div id="<%: string.Format("replay_{0}", Model.Value.Id) %>">
	</div>
</div>
